<?php

namespace App\Http\Controllers\Admin;

use App\Http\Controllers\Controller;
use App\Http\Requests\ImageUploadRequest;
use App\Http\Responses\Response;
use Illuminate\Http\JsonResponse;

class ImageController extends Controller
{
    private const URL_PREFIX = "http://www.blog.com/storage/";
    public function save(ImageUploadRequest $request): JsonResponse {
        $path = $request->file('img')->storePublicly("images");

        return Response::insert_success([
            "url" => self::URL_PREFIX . $path
        ]);
    }
}
